<?php

namespace \Helpers;

class StringHelper
{
    const EMAIL_DOMAIN = 'AUTO_TEST_USER';

    public static function generateRandomString($length = 10)
    {
        return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
    }

    public static function generateEmail()
    {
        return self::generateRandomString() . '@' . self::EMAIL_DOMAIN . '.TEST';
    }

    public static function getDataThrowCurl()
    {
        $email = self::generateEmail();
        $url = 'http://m.test.mainbox.com/test/activationCode?password=Zum2qX9&email=' . $email;
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_USERPWD, 'mainbox' . ":" . 'asd123');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $curl_scraped_page = curl_exec($ch);
        curl_close($ch);

        return $curl_scraped_page;
    }
}